#ifndef RiskServer_H
#define RiskServer_H
#include "shorttcpclient.h"
#include "Msg/HashtableMsg.h"
#include "Msg/ArrayListMsg.h"
#include "View/rspinterface.h"

class RiskServer
{
public:
    RiskServer();

    void InitServerAddr(HashtableMsg htm_server_list);

//    bool Login(const QString qsUser, const QString qsPwd, QString& qsErrMsg);
    //3306 机构清单
    bool BranchRiskStatQry(const QString& sBranchID, ArrayListMsg& alm, QString& qsErrMsg);

    //3062 风险客户查询
    bool RiskCustListQry(const QString qsCondition, ArrayListMsg &alm, QString &qsErrMsg);

    //3063
    bool CustDetailQry(const QString acctNo,RspInterface* pRsp, QString &qsErrMsg);

    //3066 发送强平单
    bool SendForceOrder(const QString acctNo,const QString fcOrderInfo, RspInterface * pRsp);

    //3070撤单
    bool CancelForceOrder(const QString qsOrderNo, QString &qsErrMsg);

    //3097 平仓试算
    bool TryCalcRiskInfo(const QString acctNo,const QString reqInfo, RspInterface * pRsp);

    //3065
    bool QueryPartMatchCovOrder(const QString reqInfo, RspInterface * pRsp);

    int GetRiskWatchMode();

    //3098
    bool QueryProdPrice(const QString reqInfo, RspInterface * pRsp);

    //3093
    bool RiskTestCalc(const QString reqInfo, RspInterface *pRsp, QString &qsErrMsg);

    //3091
    bool QueryRiskCustStatics(const QString reqInfo, RspInterface *pRsp, QString &qsErrMsg);

    //3064
    bool QueryRiskTip(const QString reqInfo, RspInterface *pRsp, QString &qsErrMsg);

    //3081
    bool OperRiskDegree(const QString reqInfo, RspInterface *pRsp, QString &qsErrMsg);

    //3309
    bool CreateBatchForceOrder(const QString reqInfo, RspInterface *pRsp, QString &qsErrMsg);
protected:
    bool GetNetAddress(QString& qsIP, int& nPort);

    //请求被正常处理了返回true，参数错误或者通讯失败都返回false
    bool TransForNormal(const std::string& sReq, std::string& sRsp, QString& qsErrMsg);
private:
    ShortTcpClient  m_comClient;
    HashtableMsg    m_server_list;
    unsigned int    m_nCurSevPos;
    int             m_nRiskWatchMode;   // 1风险监控平面列表显示，0用树形列表显示
};

#endif // RiskServer_H
